import MyArrayList.MyArrayList;

public class Test {
    public static void main(String[] args) {
        MyArrayList<String> list = new MyArrayList<>();
        list.add("Hello");
        list.add("World");

        System.out.println("元素个数: " + list.size());
        System.out.println("第一个元素: " + list.get(0));
        System.out.println("第二个元素: " + list.get(1));

        list.display();

        MyArrayList<Integer> myArrayList = new MyArrayList<Integer>();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.add(5);
        myArrayList.display();

        myArrayList.add(1,10);
        myArrayList.display();

        System.out.println(myArrayList.contains(10));
        System.out.println(myArrayList.contains(100));
        System.out.println(myArrayList.indexOf(10));
        System.out.println(myArrayList.indexOf(100));

        System.out.println(myArrayList.get(1));

        myArrayList.set(0,99);
        myArrayList.display();
        System.out.println();


        myArrayList.remove(10);
        myArrayList.display();
        System.out.println();

        myArrayList.remove(10);
        myArrayList.display();
        System.out.println();
        System.out.println();

        myArrayList.clear();
        System.out.println(myArrayList.size());
        myArrayList.display();

        myArrayList.add(19999);
        myArrayList.display();
    }
//    public static void main1(String[] args) {
//        MyArrayList myArrayList = new MyArrayList();
//
//        myArrayList.add(1);
//        myArrayList.add(2);
//        myArrayList.add(3);
//        myArrayList.add(4);
//        myArrayList.add(5);
//        myArrayList.display();
//
//        myArrayList.add(1,10);
//        myArrayList.display();
//
//        System.out.println(myArrayList.contains(10));
//        System.out.println(myArrayList.contains(100));
//        System.out.println(myArrayList.indexOf(10));
//        System.out.println(myArrayList.indexOf(100));
//
//        System.out.println(myArrayList.get(1));
//
//        myArrayList.set(0,99);
//        myArrayList.display();
//        System.out.println();
//
//
//        myArrayList.remove(10);
//        myArrayList.display();
//        System.out.println();
//
//        myArrayList.remove(10);
//        myArrayList.display();
//        System.out.println();
//        System.out.println();
//
//        myArrayList.clear();
//        myArrayList.display();
//
//        myArrayList.add(19999);
//        myArrayList.display();
//    }
}
